<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="title">#{msgs.Administration_AccessIndex_pageTitle}</ui:define>
		<ui:define name="manuBar">
			<h:form>
				<p:menubar autoSubmenuDisplay="true" id="menu"
					style="font-size:small">
					<p:menuitem value="#{msgs.Administration_administrationMenu_Home}" url="/controlling/index.xhtml"
						icon="ui-icon-document" immediate="true"
						onstart="waiteDialog.show();" />
					<p:menuitem value="#{msgs.Administration_administrationMenu_AdministrationIndex}"
						url="/controlling/administration/administrationIndex.xhtml"
						icon="ui-icon-gear" immediate="true" onstart="waiteDialog.show();" />
					
					<p:menuitem value="#{msgs.Administration_Access_AddAccess}" icon="ui-icon-document"
						update=":frm_aceess" immediate="true"
						actionListener="#{accessBean.toAddAccess}"
						oncomplete="accessDlg.show()" />
				</p:menubar>
			</h:form>
		</ui:define>
		<ui:define name="content">
			<p:panel header="#{msgs.Administration_Access_AllAccess}">
				<h:form id="frm_allAccess">
					<p:dataTable value="#{accessBean.accessList}" var="access"
						paginator="true" rows="25" editable="true">
						<p:column headerText="#{msgs.Administration_Access_AccessName}" sortBy="#{access.name}"
							filterBy="#{access.name}" filterMatchMode="contains"
							style="width:auto">
							<h:outputText value="#{access.name}" />
						</p:column>

						<p:column headerText="#{msgs.Administration_General_Options}" tyle="font-size: smaller;text-align: center;width:auto">
							<p:commandButton actionListener="#{accessBean.toUpdateAccess}"
								ajax="true" image="ui-icon-pencil" title="#{msgs.Administration_General_Update}"
								update=":frm_aceess" style="width: 30px;height: 30px"
								oncomplete="accessDlg.show();">
								<f:setPropertyActionListener value="#{access}"
									target="#{accessBean.access}" />
							</p:commandButton>
							<p:spacer width="20" />
							<p:commandButton action="#{accessBean.deleteAccess}" ajax="true"
								onstart="waiteDialog.show();" oncomplete="waiteDialog.hide();"
								update="@form" style="width: 30px;height: 30px"
								image="ui-icon-trash" title="#{msgs.Administration_General_Delete}">
								<f:setPropertyActionListener value="#{access}"
									target="#{accessBean.access}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
					<p:messages id="msgs" />
				</h:form>
			</p:panel>
			<p:dialog widgetVar="accessDlg" modal="true"
				header="#{msgs.Administration_AccessIndex_AccessInformation}" resizable="false">
				<h:form id="frm_aceess">
					<h:panelGrid columns="3" id="ss">
						<h:outputText value="#{msgs.Administration_Access_AccessName}" />
						<p:inputText value="#{accessBean.access.name}"
							required="true" requiredMessage="#{msgs.Administration_Access_AccessNameRequired}" />
						<p:commandButton value="#{msgs.Administration_General_Save}"
							actionListener="#{accessBean.saveAccess}"
							style="height: 30px;font-size: small"
							onstart="waiteDialog.show()"
							oncomplete="waiteDialog.hide();accessDlg.hide();"
							update=":frm_allAccess " />
					</h:panelGrid>
				</h:form>
			</p:dialog>
		</ui:define>
	</ui:composition>
</body>
</html>
